package com.moyun.search.service;

import com.moyun.search.common.result.Result;
import com.moyun.search.common.result.ResultUtil;
import com.moyun.search.domain.ProjectAttachment;
import com.moyun.search.dao.mapper.ProjectAttachmentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 项目附件服务
 * @author: zealon
 * @since: 2021/12/22
 */
@Service
public class ProjectAttachmentService {

    @Autowired
    private ProjectAttachmentMapper projectAttachmentMapper;

    public Result getList(Integer projectId){
        List<ProjectAttachment> list = this.projectAttachmentMapper.findPageWithResult(projectId);
        return ResultUtil.success(list);
    }

    public ProjectAttachment create(ProjectAttachment attachment) {
        this.projectAttachmentMapper.insert(attachment);
        return attachment;
    }
}